<template>
  <div>
    <hello />
    <button @click="getMsg">调用子组件的方法</button>
  </div>
</template>

<script>
import hello from "@/components/HelloWorld.vue";
export default {
  data() {
    return {
      msg: "天王盖地虎",
    };
  },
  methods: {
    getMsg() {
      console.log(this.$children[0].msg);
      this.$children[0].handler();
    },
  },
  created() {},
  mounted() {},
  components: {
    hello,
  },
  computed: {},
  watch: {},
};
</script>

<style lang="scss" scoped></style>
